# encoding: utf-8
"""
@author: 夏洛
@QQ: 1972386194
@file: 01-test.py
"""
import threading
import time

import requests
def test(url):
    res = requests.get(url)
    return res
if __name__ == '__main__':
    start = time.time()
    url = 'http://www.baidu.com'
    for i in range(10):
        test(url)
    res = time.time() - start
    print(res,'单线程')


def tests(url,i):
    print(i)
    res = requests.get(url)
    return res
if __name__ == '__main__':
    start = time.time()
    url = 'http://www.baidu.com'
    t = []
    for i in range(10):
        thread = threading.Thread(target=tests, args=(url,i))
        t.append(thread)
        thread.start()
    for i in t:
        i.join()
    res = time.time() - start
    print(res,'多线程')